{extend name="public:layout" /}
{block name="title"}执行SQL语句{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 执行SQL语句</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="alert alert-info">
                提示：该操作请谨慎使用，防止误操作数据库！
            </div>
            <form role="form">
                <div class="form-group">
                    <textarea class="form-control" id="sql" rows="6" placeholder="请输入要执行的SQL语句"></textarea>
                </div>
                <button type="button" id="btnSub" class="btn btn-large btn-info btn-block">确认执行</button>
            </form>
            <div id="result"></div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $('#btnSub').click(function(){
        In('layer',function () {
            var sql = $('#sql').val();
            if(sql==''){
                layer.alert('请输入sql语句！');
                return false;
            }else{
                $.post("{:url('index')}",{sql:sql},function(data){
                    $('#result').html(data);
                });
            }
        })
    });
</script>
{/block}